package com.gc.server.vo.up;


import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.gc.server.entity.LinkGoodsEntity;
import com.gc.server.entity.ShopEntity;
import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;


import com.gc.server.entity.SaleRecordEntity;
import com.gc.server.vo.SaleRecordVo;


/**
 * 销量实体
 * 表名 sale_record
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date ${datetime}
 */
@Data
public class SaleRecordUp implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //店铺ID
    @ExcelProperty("店铺ID")
    private Long shopId;

    @ExcelProperty("店铺编号")
    private String shopCode;

    //产品ID
    @ExcelProperty("产品ID")
    private Long goodsId;

    @ExcelProperty("产品编号")
    private String goodsCode;

    //时间
    @ExcelProperty("时间")
    @DateTimeFormat(value = "MM/dd/yyyy")
    private Date time;

    //数量
    @ExcelProperty("数量")
    private Integer amount;


    public SaleRecordUp() {

    }

    public SaleRecordVo toVo() {
        SaleRecordEntity entity = new SaleRecordEntity();
        SaleRecordVo vo = new SaleRecordVo(entity);
        entity.setId(id);
        entity.setShopId(shopId);
        entity.setGoodsId(goodsId);
        entity.setTime(time);
        entity.setAmount(amount);
        ShopEntity shopEntity = new ShopEntity();
        shopEntity.setCode(shopCode);
        LinkGoodsEntity goodsEntity = new LinkGoodsEntity();
        goodsEntity.setCode(goodsCode);
        vo.setGoods(goodsEntity);
        vo.setShop(shopEntity);
        return vo;
    }


}
